<!DOCTYPE html>
<html>
	<head>
		<title>记账本</title>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="description" content="Tiny-bookkeeping v1.0.0" />
		<meta name="Author" content="Tiny" />
		<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<meta name ="apple-mobile-web-app-title"content ="bill">
		<link rel="shortcut icon" type="text/css" href="img/favicon.ico" />
		<link rel="apple-touch-icon-precomposed" href="img/banner3_03.png" />
		<link rel="apple-touch-startup-image" href="start/Startpage@3x.png"  media="screen and (device-width: 414px) and (orientation: portrait)" >
		<link rel="apple-touch-startup-image" href="start/Startpage@3x.png"  media="screen and (device-width: 736px) and (orientation: landscape)" >
		<link rel="apple-touch-startup-image" href="start/640+960.png" media="screen and (device-width: 320px)  and (orientation: portrait)" >
		<link rel="apple-touch-startup-image" href="start/640+960.png" media="screen and  (device-width: 480px) and (orientation: landscape)" >
		<link rel="apple-touch-startup-image" href="start/640_1136.png" media="screen and (device-width: 320px) and (orientation: portrait)" >
		<link rel="apple-touch-startup-image" href="start/640_1136.png" media="screen and (device-width: 568px) and (orientation: landscape)" >
		<link rel="apple-touch-startup-image" href="start/Startpage@2x.png" media="screen and (device-width: 375px) and (orientation: portrait)" >
		<link rel="apple-touch-startup-image" href="start/Startpage@2x.png" media="screen and (device-width: 667px) and (orientation: landscape)" >
		<link rel="apple-touch-startup-image" href="start/Startpage@iPhone X.png" media="screen and (device-width: 375px) and (orientation: portrait)" >
		<link rel="apple-touch-startup-image" href="start/Startpage@iPhone X.png" media="screen and (device-width: 812px) and (orientation: landscape)" >
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/phpto.css"/>
	</head>
	<style type="text/css">
		#list {
			/*避免导航边框和列表背景边框重叠，看起来像两条边框似得；*/
			margin-top: -1px;
		}
		
		.mui-input-row {
			background-color: #ffffff;
		}
		label{
			text-align: right;
		}
		body{
			background-image: url(start/Startpage@2x.png);
			height: 100%;
			background-size: 100%;
		}
		.mui-content{
			opacity: 0.9;
		}
		@-webkit-keyframes rotation {
	    from {-webkit-transform: rotate(0deg);
		}to {
		    -webkit-transform: rotate(360deg);
		}}
		
		.Rotation {
		    -webkit-transform: rotate(360deg);
		    animation: rotation 8s linear infinite;
		    -moz-animation: rotation 8s linear infinite;
		    -webkit-animation: rotation 8s linear infinite;
		    -o-animation: rotation 8s linear infinite;
		}
	</style>

	<body>
		<header class="mui-bar mui-bar-nav" style="padding: 0;">
			<!--<img class="mui-pull-left" src="img/Tiny.png" style="height: 40px;border-radius: 50%;"/>-->
			<h1 class="mui-title">
				<span>新账单</span>
			</h1>
			<!--<img style="line-height: 20px;margin: 5px;" data-preview-src="" data-preview-group="1" class="mui-pull-right Rotation" height="30px" src="start/weixin.jpg"/>
			<img style="display: none;" src="start/zhifu.jpg"data-preview-src=""class="mui-pull-right" data-preview-group="1"/>-->
		</header>
		<div class="mui-content">
			<div class="mui-content-padded" >
				<div class="mui-input-row ">
					<label >预算金额：</label>
					<input type="number" id="isbudget" class="mui-input-clear" placeholder="请输入预算金额（单位：元）">
				</div>
				<div class="mui-button-row ">
					 <button type="button"data-loading-icon="mui-spinner mui-spinner-custom" class="mui-btn mui-btn-primary mui-btn-block">确认</button>
				</div>
			</div>
		</div>
		<div style="width: 100%;height: 40px;position: fixed;bottom: 0;text-align: center;line-height: 40px;">
			<a style="color: black;" href="tel:1-862-551-8603">联系我：18625518603</a>
			<span> &nbsp;QQ:839435033</span>
		</div>
		<script type="text/javascript" src="js/date.js"></script>
		<script src="js/mui.zoom.js"></script>
		<script src="js/mui.previewimage.js"></script>
		<script>
			document.getElementById("isbudget").focus();
			var nowDate = now();
			var recordding = {
				count:1,
				budget:0,
				detail:"预算金额",
				nowDate:nowDate,
				total:0
			}
			if(localStorage.getItem("Book") == null){
				console.log('新的账单');
			}else{
				recordding.count = localStorage.getItem("count");
				window.location.href = "main.html";
			}
			var Book = [];
			var bag = {};
			mui(document.body).on('tap', '.mui-btn', function(e) {
				mui(this).button('loading');
				if(document.getElementById("isbudget").value == '')
				{
					recordding.budget = 0;
				}else{
					recordding.budget = document.getElementById("isbudget").value;
				}
				nowDate = now();
				recordding.nowDate = nowDate;
				Book.push(recordding);
				localStorage.setItem('Book',JSON.stringify(Book));
				setTimeout(function() {
					mui(this).button('reset');
//					window.location.reload();
					window.location.href = "main.html";
				}.bind(this), 500);
			});
			var nativeWebview, imm, InputMethodManager;
			var initNativeObjects = function() {
				if(mui.os.android) {
					var main = plus.android.runtimeMainActivity();
					var Context = plus.android.importClass("android.content.Context");
					InputMethodManager = plus.android.importClass("android.view.inputmethod.InputMethodManager");
					imm = main.getSystemService(Context.INPUT_METHOD_SERVICE);
				} else {
					nativeWebview = plus.webview.currentWebview().nativeInstanceObject();
				}
			};
			var showSoftInput = function() {
				if(mui.os.android) {
					imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
				} else {
					nativeWebview.plusCallMethod({
						"setKeyboardDisplayRequiresUserAction": false
					});
				}
				setTimeout(function() {
					var inputElem = document.querySelector('input');
					inputElem.focus();
					inputElem.parentNode.classList.add('mui-active'); //第一个是search，加上激活样式
				}, 200);
			};
			mui.plusReady(function() {
				initNativeObjects();
				showSoftInput();
			});
			
		</script>
	</body>
		<script type="text/javascript">
		//iOS Web APP中点击链接跳转到Safari 浏览器新标签页的问题 devework.com
		//stanislav.it/how-to-prevent-ios-standalone-mode-web-apps-from-opening-links-in-safari
		if(("standalone" in window.navigator) && window.navigator.standalone){
		var noddy, remotes = false;
		document.addEventListener('click', function(event) {
		noddy = event.target;
		while(noddy.nodeName !== "A" && noddy.nodeName !== "HTML") {
		noddy = noddy.parentNode;
		}
		if('href' in noddy && noddy.href.indexOf('http') !== -1 && (noddy.href.indexOf(document.location.host) !== -1 || remotes))
		{
		event.preventDefault();
		document.location.href = noddy.href;
		}
		},false);
		}
		</script>
		<script type="text/javascript">
			mui.previewImage();
		</script>
</html>